import { Space } from "antd";
import { useEffect, type ReactElement } from "react";
import Filter from "../Filter";
import Table from '../Table'
import { useAppDispatch, useAppSelector } from "@/store/hooks";
import { getGearListAsync } from "@/store/withdrawGear/withdrawGearSlice";
import Create from "../Create";

export default function Panel():ReactElement<typeof Space, 'div'>{
  const {params,table} = useAppSelector(state => state.withdrawGear)
  const dispatch = useAppDispatch()
  useEffect(() => {
    if(['init', 'error'].includes(table.status)){
      dispatch(getGearListAsync({...params}))
    }
  }, [])
  return <Space size='large' direction="vertical" className="w-full">
    <Filter />
    <Table />
    <Create />
  </Space>
}